home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmZip
- BorderStyle = 1 'Fixed Single
- Caption = "Add file(s) to the zip file"
- ClientHeight = 5325
- ClientLeft = 1065
- ClientTop = 1200
- ClientWidth = 6525
- Icon = "frmZip.frx":0000
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5325
- ScaleWidth = 6525
- StartUpPosition = 1 'CenterOwner
- Begin VB.CommandButton cmdFilters
- Caption = "&Filters..."
- Height = 375
- Left = 5160
- TabIndex = 12
- Top = 600
- Width = 1215
- End
- Begin VB.TextBox txtFilesToProcess
- Height = 1050
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- ToolTipText = "For multiple choices, seperate each filter with a line feed."
- Top = 360
- Width = 4815
- End
- Begin VB.CommandButton cmdFilesToProcess
- Caption = "&Browse"
- Height = 285
- Left = 4215
- TabIndex = 1
- Top = 1470
- Width = 735
- End
- Begin VB.CommandButton cmdSfx
- Caption = "&SFX..."
- Height = 375
- Left = 5160
- TabIndex = 14
- Top = 1495
- Width = 1215
- End
- Begin VB.Frame fraSplit
- Caption = "Splitting"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 975
- Left = 120
- TabIndex = 19
- Top = 3780
- Width = 4815
- Begin VB.CheckBox chkSplitting
- Caption = "C&reate a zip file that is split into smaller pieces"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 240
- Width = 3735
- End
- Begin VB.TextBox txtSplitSize
- Enabled = 0 'False
- Height = 285
- Left = 3120
- TabIndex = 9
- Top = 570
- Width = 615
- End
- Begin VB.Label lblK
- Caption = "kbytes."
- Enabled = 0 'False
- Height = 255
- Left = 3840
- TabIndex = 21
- Top = 600
- Width = 495
- End
- Begin VB.Label lblSplitSize
- Caption = "I want the zip file to be split into pieces of"
- Enabled = 0 'False
- Height = 255
- Left = 120
- TabIndex = 20
- Top = 600
- Width = 3015
- End
- End
- Begin VB.Frame fraSkipping
- Caption = "Do not zip files that..."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1260
- Left = 120
- TabIndex = 18
- Top = 2430
- Width = 4815
- Begin VB.CheckBox chkSkipIfOlderVersion
- Caption = "Are older &versions than files already in the zip file"
- Height = 195
- Left = 120
- TabIndex = 7
- Top = 960
- Width = 3855
- End
- Begin VB.CheckBox chkSkipIfOlderDate
- Caption = "Are ol&der than files already in the zip file"
- Height = 195
- Left = 120
- TabIndex = 6
- Top = 720
- Width = 3855
- End
- Begin VB.CheckBox chkSkipIfNotExisting
- Caption = "Are ¬ already in the zip file"
- Height = 195
- Left = 120
- TabIndex = 5
- Top = 480
- Width = 2775
- End
- Begin VB.CheckBox chkSkipIfExisting
- Caption = "Are &already in the zip file"
- Height = 195
- Left = 120
- TabIndex = 4
- Top = 240
- Width = 2655
- End
- End
- Begin VB.CommandButton cmdPasswordProtect
- Caption = "&Password..."
- Height = 375
- Left = 5160
- TabIndex = 13
- Top = 1045
- Width = 1215
- End
- Begin VB.ComboBox cmbCompLevel
- Height = 315
- Left = 1630
- Style = 2 'Dropdown List
- TabIndex = 10
- Top = 4870
- Width = 1935
- End
- Begin VB.Frame fraFolders
- Caption = "Folders and paths"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 780
- Left = 120
- TabIndex = 16
- Top = 1560
- Width = 2175
- Begin VB.CheckBox chkProcessSubFolders
- Caption = "&Include subfolders"
- Height = 195
- Left = 120
- TabIndex = 2
- Top = 240
- Value = 1 'Checked
- Width = 1815
- End
- Begin VB.CheckBox chkPreservePaths
- Caption = "S&tore paths in zip file"
- Height = 195
- Left = 120
- TabIndex = 3
- Top = 480
- Value = 1 'Checked
- Width = 1935
- End
- End
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "&Cancel"
- Height = 375
- Left = 5160
- TabIndex = 15
- Top = 1950
- Width = 1215
- End
- Begin VB.CommandButton cmdZip
- Caption = "&Zip!"
- Height = 375
- Left = 5160
- TabIndex = 11
- Top = 150
- Width = 1215
- End
- Begin VB.Label lblFilesToProcess
- Caption = "Enter the list of files to add or update in the zip file:"
- Height = 255
- Left = 120
- TabIndex = 22
- Top = 120
- Width = 4335
- End
- Begin VB.Label lblCompLevel
- Caption = "Compression factor:"
- Height = 255
- Left = 120
- TabIndex = 17
- Top = 4915
- Width = 1575
- End
- Attribute VB_Name = "frmZip"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '==================================================================
- ' Description: The frmZip form is displayed whenever it is time for
- ' the user to select files to add or update in the zip
- ' file.
- '==================================================================
- ' We keep a link on the XceedZip instance that we receive in the
- ' ShowForm method, so we don't depend on the main form's instance
- Dim xCurrentZip As XceedZip
- '------------------------------------------------------------------------------------
- 'This sub calls data loading functions so that all of the form's
- 'controls are initialized with the correct values
- '------------------------------------------------------------------------------------
- Private Sub LoadProperties(xZip As XceedZip)
- Call LoadComboBox(xZip)
- Call LoadFolderProperties(xZip)
- Call LoadSkippingProperties(xZip)
- Call LoadSplitFileProperties(xZip)
- cmbCompLevel.ItemData(cmbCompLevel.ListIndex) = xZip.CompressionLevel
- End Sub
- '------------------------------------------------------------------------------------
- 'Fill the Compression Level combo box with the appropriate choices
- '------------------------------------------------------------------------------------
- Private Sub LoadComboBox(xZip As XceedZip)
- cmbCompLevel.AddItem ("Maximum")
- cmbCompLevel.ItemData(0) = xclHigh
- cmbCompLevel.AddItem ("Normal")
- cmbCompLevel.ItemData(1) = xclMedium
- cmbCompLevel.AddItem ("Low")
- cmbCompLevel.ItemData(2) = xclLow
- cmbCompLevel.AddItem ("No Compression")
- cmbCompLevel.ItemData(3) = xclNone
- cmbCompLevel.ListIndex = (1)
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the form's "files and paths" checkboxes from the xZip object's
- 'PreservePaths and ProcessSubfolders properties.
- '------------------------------------------------------------------------------------
- Private Sub LoadFolderProperties(xZip As XceedZip)
- chkPreservePaths.Value = IIf(xZip.PreservePaths, vbChecked, vbUnchecked)
- chkProcessSubFolders.Value = IIf(xZip.ProcessSubfolders, vbChecked, vbUnchecked)
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the form's "Skipping" options from the xZip object's properties
- '------------------------------------------------------------------------------------
- Private Sub LoadSkippingProperties(xZip As XceedZip)
- chkSkipIfExisting.Value = xZip.SkipIfExisting
- chkSkipIfNotExisting.Value = xZip.SkipIfNotExisting
- chkSkipIfOlderDate.Value = xZip.SkipIfOlderDate
- chkSkipIfOlderVersion.Value = xZip.SkipIfOlderVersion
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the form's controls related to splitting from the xZip objects
- '------------------------------------------------------------------------------------
- Private Sub LoadSplitFileProperties(xZip As XceedZip)
- txtSplitSize.Text = xZip.SplitSize
- End Sub
- '------------------------------------------------------------------------------------
- ' Shows the frmZip form to the user in order to allow files to be selected
- ' for zipping or updating in the zip file.
- '------------------------------------------------------------------------------------
- Public Function ShowForm(xZip As XceedZip) As Boolean
- ' We keep a link on the xZip, for other forms we could open
- Set xCurrentZip = xZip
- ' Reset the tag to 0, because it is used later to determine if
- ' the frmZip form was closed with instructions to start zipping
- frmZip.Tag = "0"
- ' Set the frmZip form's controls from xZip's property values
- Call LoadProperties(xZip)
- ' Show the frmZip form
- frmZip.Show vbModal
- ' If tag = "1" then the user clicked on the Zip! button located
- ' on the frmZip form. That form has taken care of setting the xZip
- ' objects property values, so we can then immediately start zipping
- ' by calling the sample application's UpdateZipFile sub.
- If frmZip.Tag = "1" Then
- Call UpdateZipFile(xZip)
- End If
- ' If tag = "1" then the user clicked on Zip! and this function returns TRUE
- ShowForm = (frmZip.Tag = "1")
- End Function
- '------------------------------------------------------------------------------------
- 'Sets the FilesToProcess property based on the info entered on the form
- '------------------------------------------------------------------------------------
- Private Sub UpdateFileProperties(xZip As XceedZip)
- xZip.FilesToProcess = txtFilesToProcess.Text
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the PreservePaths and ProcessSubfolders properties based on the
- 'info entered on the form.
- '------------------------------------------------------------------------------------
- Private Sub UpdateFolderProperties(xZip As XceedZip)
- xZip.PreservePaths = chkPreservePaths.Value
- xZip.ProcessSubfolders = chkProcessSubFolders.Value
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the SkipIf* group of properties based on the info entered on the form.
- '------------------------------------------------------------------------------------
- Private Sub UpdateSkippingProperties(xZip As XceedZip)
- xZip.SkipIfExisting = chkSkipIfExisting.Value
- xZip.SkipIfNotExisting = chkSkipIfNotExisting.Value
- xZip.SkipIfOlderDate = chkSkipIfOlderDate.Value
- xZip.SkipIfOlderVersion = chkSkipIfOlderVersion.Value
- End Sub
- '------------------------------------------------------------------------------------
- 'Sets the SplitSize property based on the info entered on the form.
- '------------------------------------------------------------------------------------
- Private Sub UpdateSplitFileProperties(xZip As XceedZip)
- If chkSplitting.Value = 1 Then
- xZip.SplitSize = txtSplitSize
- Else
- xZip.SplitSize = 0 ' 0 means that the zip file will not be split.
- End If
- End Sub
- '------------------------------------------------------------------------------------
- 'Calls functions that update xZip's properties based on information
- 'found on the form. This is called when the Zip! button is pressed
- 'on the frmZip form.
- '------------------------------------------------------------------------------------
- Private Sub UpdateZipFile(xZip As XceedZip)
- Call UpdateFileProperties(xZip)
- Call UpdateFolderProperties(xZip)
- xZip.CompressionLevel = cmbCompLevel.ItemData(cmbCompLevel.ListIndex)
- Call UpdateSkippingProperties(xZip)
- Call UpdateSplitFileProperties(xZip)
- End Sub
- '------------------------------------------------------------------------------------
- 'Updates the forms controls if you have selected to create a split zip file.
- '------------------------------------------------------------------------------------
- Private Sub chkSplitting_Click()
- lblSplitSize.Enabled = (chkSplitting.Value = 1)
- lblK.Enabled = (chkSplitting.Value = 1)
- txtSplitSize.Enabled = (chkSplitting.Value = 1)
- End Sub
- '------------------------------------------------------------------------------------
- ' If Zip! is clicked, tag takes the "1" value
- '------------------------------------------------------------------------------------
- Private Sub cmdZip_Click()
- Tag = "1"
- Hide
- End Sub
- '------------------------------------------------------------------------------------
- ' If cancel is pressed, tag stays at "0"
- '------------------------------------------------------------------------------------
- Private Sub cmdCancel_Click()
- Hide
- End Sub
- '------------------------------------------------------------------------------------
- ' If the browse button is pressed, a dialog box allowing the user to
- ' select files to process will appear. The selected files will then
- ' be placed in the edit box where the user can see them and edit them.
- '------------------------------------------------------------------------------------
- Private Sub cmdFilesToProcess_Click()
- Dim Files As String
- Files = SelectZipFile$(ChooseFiles) ' Open a dialog to select the files
- If Len(Files) > 0 Then
- txtFilesToProcess = txtFilesToProcess + IdentifyFiles(Files)
- End If
- End Sub
- '------------------------------------------------------------------------------------
- 'Opens up the frmFilters window to allow the user to filter files
- 'being processed based on various criteria like size, dates and file attributes.
- '------------------------------------------------------------------------------------
- Private Sub cmdFilters_Click()
- Call frmFilters.ShowForm(xCurrentZip)
- Call Unload(frmFilters)
- End Sub
- '------------------------------------------------------------------------------------
- 'Opens up the frmPassword window to allow the user to specify an encryption password
- '------------------------------------------------------------------------------------
- Private Sub cmdPasswordProtect_Click()
- Call frmPassword.ShowForm(xCurrentZip)
- Call Unload(frmPassword)
- End Sub
- '------------------------------------------------------------------------------------
- 'Opens up the frmSfx window to allow the user to configure
- 'their self-extracting zip files.
- '------------------------------------------------------------------------------------
- Private Sub cmdSfx_Click()
- Call frmSfx.ShowForm(xCurrentZip)
- Call Unload(frmSfx)
- End Sub
- '------------------------------------------------------------------------------------
- 'Forces the user to enter numerical characters in the SplitSize
- 'textbox.
- '------------------------------------------------------------------------------------
- Private Sub txtSplitSize_KeyPress(KeyAscii As Integer)
- KeyAscii = ValidateNumbers(KeyAscii)
- End Sub
-